﻿
@{
    ViewBag.Title = "Login";
    Layout = null;
}

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
    <link rel="stylesheet" type="text/css" href="~/Content/reset.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/loginAndRegisterCommon.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/form.css" />
    <link rel="stylesheet" type="text/css" href="~/Content/login.css" />
    <script src="~/Scripts/jquery-1.9.1.min.js"></script>
    <link href="~/Content/alertStyle.css" rel="stylesheet" type="text/css" />
    <script src="~/Scripts/alert.js" type="text/javascript"></script>

    <script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?4fd648fda0a3af92d7a11dfd25b34442";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
    </script>
</head>

<body>
    <div class="header">
        <div class="h_back">
            <a href="@Url.Action("Votes","Home")">
                <img src="~/Content/img/iconfont-fanhui.png" />
            </a>
        </div>
        <h1 class="h_title">
            登录
        </h1>
    </div>
    <div class="main">
        <div class="input-form">
            <ul>
                <li>
                    <span>
                        账号
                    </span>
                    <div class="input-form-box" style="width:10rem;">
                        <input type="text" name="UserName" id="UserName" value="" placeholder="手机号/用户名" />
                    </div>
                </li>
                <li>
                    <span>
                        密码
                    </span>
                    <div class="input-form-box">
                        <input class="password-input" type="password" name="PassWord" id="PassWord" value="" placeholder="请输入密码" />
                        <span id="lblPassword"></span>
                    </div>
                    <div class="input-slider">
                        <div class="input-slider-box">
                            <input type="checkbox" name="showpwd" id="showpwd" value="" />
                            <label class="input-slider-bottom" for="showpwd">
                            </label>
                            <span class="off">
                                <em>•••</em>
                            </span>
                            <span class="on">
                                <em>abc</em>
                            </span>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <a href="javascript:;" class="jd_btn" id="submit">登录</a>
        <p><a href="@ViewBag.findPassword">找回密码?</a></p>
        <a href="/Home/Register" class="jd_btn_hollow">立即注册</a>
    </div>
    <div class="copy">
        <p style="text-align:center;">Copyright@2015-2016, AII Rights Reserved </p>
        <p style="text-align:center;">广西爱农人电子商务有限公司</p>
        <p style="text-align:center;">桂ICP备16003246号-1</p>
    </div>
   
</body>

<script type="text/javascript">

    $(function () {
        document.onkeydown = function (e) {
            var ev = document.all ? window.event : e;
            if (ev.keyCode == 13) {
                return $("#submit").click();
            }
        }
    });
    $("#showpwd").on("click", function () {
        if ($(this).prop("checked")) {
            $("#PassWord").attr("type", "text");
        } else {
            $("#PassWord").attr("type", "password");
        }
    });
    $("#submit").on("click", function () {
        var userName=$.trim($("#UserName").val());
        var password=$.trim($("#PassWord").val())
        if (userName == "") {
            $.fn.SK_alert("请输入用户名！");
            return;
        }
        if (password == "") {
            $.fn.SK_alert("请输入密码！");
            return;
        }
        $.ajax({
            type: "post",
            url: '@Url.Action("UserInfoLogin")',
            data: { userName: userName, password: password },
            async: false,
            success: function (data) {
                if (data.flag) {
                    window.location.href = "/Home/Votes";
                } else {
                    $.fn.SK_alert(data.content);
                }
            }
        });
    });
</script>
</html>

